package com.ruoyi.common.filter;

import com.ruoyi.common.utils.DictUtils;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.*;
import java.io.IOException;

/**
 * description
 *
 * @author h w
 * @version 1.0
 * @date 2023/3/30 20:10
 */
public class DelayFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException
    {

    }

    @SneakyThrows
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        String delayString = DictUtils.getDictValue("delay_time", "seconds");
        //Thread.sleep(Integer.valueOf(delayString) * 1000);
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy()
    {

    }

}
